package tank.client.game;

import java.awt.*;

/**
 * 方块
 */
public class Square {

    public static final int TYPE_NORMAL = 0;//普通方块（子弹能消）
    public static final int TYPE_IRON = 1;//钢铁方块（子弹不能消，不能穿）
    public static final int TYPE_WATER = 2;//水流方块（子弹能穿，不能消）
    public static final int LENGTH = 20;

    private int x;
    private int y;
    private int type;
    private boolean belongHome = false;
    private boolean removed = false;

    public Square(int x, int y,  int type) {
        this.x = x;
        this.y = y;
        this.type = type;
    }

    public Square() {
    }

    public boolean isBelongHome() {
        return belongHome;
    }

    public void setBelongHome(boolean belongHome) {
        this.belongHome = belongHome;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isRemoved() {
        return removed;
    }

    public void setRemoved(boolean removed) {
        this.removed = removed;
    }

    public void drawSquare(Graphics g){
        switch (type){
            case TYPE_NORMAL:
                g.setColor(Color.ORANGE);
                break;
            case TYPE_IRON:
                g.setColor(Color.LIGHT_GRAY);
                break;
            case TYPE_WATER:
                g.setColor(Color.BLUE);
                break;
        }
        g.fill3DRect(x,y,LENGTH,LENGTH,false);
    }
}
